package org.hnxxxy.ebms.controller;

import io.swagger.annotations.ApiOperation;
import org.hnxxxy.ebms.common.Result;
import org.hnxxxy.ebms.pojo.RecruitStu;
import org.hnxxxy.ebms.service.RoleService;
import org.hnxxxy.ebms.vo.LoginVo;
import org.hnxxxy.ebms.vo.RoleInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WANGWEI
 * @since 2021-06-10
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public Result<String> login(@RequestBody LoginVo loginVo){
        return roleService.login(loginVo);
    }

    @PostMapping("/register")
    @ApiOperation("/register")
    public Result<String> register(@RequestBody RecruitStu recruitStu){
        return roleService.register(recruitStu);
    }

    @GetMapping("/info")
    public Result<RoleInfoVo> info(){
        return roleService.info();
    }

    @PostMapping("/logout")
    public Result<String> logout(){
        return Result.success(200,"登出");
    }
}
